{% extends 'base.html.twig' %}
{% block body_bar %}
    <h5>{{ dry_translation('list') }}</h5>
    <div class="ibox-tools">
        <a class="btn btn-outline btn-info" href="{{ path("user_new") }}" data-route="user_new">{{ dry_translation('new') }}</a>
    </div>
{% endblock %}
{% block body %}
    <table class="table table-striped">
        <thead>
            <tr>
                <th>{{ dry_translation('User.id') }}</th>
                <th>{{ dry_translation('User.username') }}</th>
                <th>{{ dry_translation('User.groups') }}</th>
                <th>{{ dry_translation('User.email') }}</th>
                <th>{{ dry_translation('User.enabled') }}</th>
                <th>{{ dry_translation('User.lastLogin') }}</th>
                <th>{{ dry_translation('User.createdAt') }}</th>
                <th>{{ dry_translation('action') }}</th>
            </tr>
        </thead>
        <tbody>
            {% for user in users %}
                <tr>
                    <td>{{ user.id }}</td>
                    <td>{{ user.username }}</td>
                    <td>{{ call_method('groupShow', user.groups)|nl2br }}</td>
                    <td>{{ user.email }}</td>
                    <td>{{ call_method('statusShow', enabledArray, user.enabled)|raw }}</td>
                    <td>{{ user.lastLoginString }}</td>
                    <td>{{ user.createdAtString }}</td>
                    <td>
                        <div class="btn-group">
                            <a class="btn btn-primary" href="{{ dry_path('user_show', user.id) }}" data-route="user_show">{{ dry_translation('show') }}</a>
                            <a class="btn btn-primary" href="{{ dry_path('user_edit', user.id) }}" data-route="user_edit">{{ dry_translation('edit') }}</a>
                            <a class="btn btn-primary" href="{{ dry_path('user_login', user.id) }}" data-route="user_login">{{ dry_translation('userSimulateLogin') }}</a>
                        </div>
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
{% endblock %}
